﻿/********************************************************************************************
 * 文件名称:	WUC_NewsList.cs
 * 设计人员:	严向晖（ｙａｎｘｉａｎｇｈｕｉ＠ｇｍａｉｌ．ｃｏｍ）
 * 设计时间:	2007-09-12
 * 功能描述:	首页显示的栏目样式
 * 注意事项:	
 * 版权所有:	Copyright (c) 2007, Fujian SIRC
 * 修改记录: 	修改时间		人员		修改备注
 *				----------		------		-------------------------------------------------
 *
 ********************************************************************************************/
using System;
using System.Diagnostics;
using System.Web.UI.WebControls;
using Shanfree.SharpMovie.BLL;
using Shanfree.SharpMovie.Model;
using Shanfree.Framework.Utility;

/// <summary>
/// 
/// </summary>
public partial class WUC_DropdownTree : DropdownTreeBase<MenuInfo>
{
    #region 属性
    /// <summary>
    /// 文本框名称
    /// </summary>
    public string Name
    {
        get
        {
            return tbName.Text;
        }
        set
        {
            tbName.Text = value;
        }
    }
    /// <summary>
    /// 节点的主键
    /// </summary>
    public string NodeID
    {
        get
        {
            return tbID.Text;
        }
        set
        {
            string nodeID = value;
            MenuInfo mInfo = this.DataSource.FindByNodeID(nodeID);
            tbID.Text = mInfo.ID;
            tbName.Text = mInfo.Name;
        }
    }
    #endregion

    #region Page_Load
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                valrArea.ErrorMessage = this.ErrorMessage;
                if (String.IsNullOrEmpty(this.ErrorMessage))
                {
                    valrArea.Visible = false;
                    lblSign.Visible = false;
                }
                //imageClose.Attributes.Add("onclick", ClientID + "HidDiv()");
                tbSelect.Attributes.Add("onclick", ClientID + "VisDiv();return false;");
                btnReset.OnClientClick = ClientID + "ChangeUrl('','');return false;";
                btnReset.Visible = this.IsClear;
            }
        }
        catch (Exception exc)
        {
            LogEntry.Log.Write(exc.ToString(), EventLogEntryType.Error, LogSourceType.一般错误);
            throw exc;
        }
    }
    #endregion

    #region 公有方法
    /// <summary>
    /// 数据绑定的方法
    /// </summary>
    public new void DataBind()
    {
        DataBind(tvEntity);
    }
    #endregion

    protected override void NodeAdd(MenuInfo t, TreeNode treeNode)
    {
        base.NodeAdd(t, treeNode);
        string script = string.Format("javascript:{0}ChangeUrl('{1}','{2}');", this.ClientID, t.Name, t.ID);
        treeNode.NavigateUrl = script;
    }
}
